#-----------------------------------
# Name: Nathan Monroe
# Project Madlibs.py
# Period: 1
# Start Date: 9/24/2013
# Last Revision Date: 9/24/2013
# Version: 1.0.0
#----------------------------
import os

swearList = ["dumb",
             "stupid",
             "retard",
             "douche",
             "faggot",
             "tit",
             "Tiity",
             "boob",
             "boobie",
             "wabachuckie",
             "vj",
             "vagina",
             "dick",
             "penis",
             "pennis",
             "ass",
             "asshole",
             "ass hole",
             "a$$",
             "A$$",
             "As$",
             "A$s",
             "fuck",
             "fucker",
             "fuck face",
             "fucked",
             "butt fucked"
             "cunt",
             "slut",
             "whore",
             "slutty",
             "sluttie",
             "dick whole",
             "shit",
             "shitter",
             "shitty",
             "damn",
             "damn it",
             "dammit",
             "rape",
             "raped",
             "raping",
             "bitch",
             "bitchy",
             "bitching",
             "nigger",
             "nigga",
             "cracker",
             "niglet",
            
             "banging",
             "tapped",
             "lick dick",
             "anol",
             "anal",
             "pussy",
             "masturbation",
             "5 nuckle shuffle",
             "jerk off",
             "jack off",
             "jumped",
             "gang-bang",
             "boner",
             "stiffey",
             "cock",
             "ass-crack",
             "bunghole",
             "pussy-hole",
             "butt head",
             "Head",
             "nipple",
             "douche bag",
             "gay",
             "lesbian",
             "bisexual",
             "queer",
             "fag",
             "faggot",
             "faggit",
             "dumbass",
             "pig-nipple-titty",
             "sausage-link",
             "dummy",
             "retard",
             "retarded",
             "anal-beads",
             "biatch",
             "cougar",
             "milf",
             "MILF",
             "stiffey",
             "ass-wacker",
             "cum dumpster",
             "cumdumpster",
             "anal",
             "Milf",
             "buttknocker"
             "dog style"]
             
             
            
             
bgColor = '0'
txtColor = 'F'

def getMenuOption(maxOptions):
    option = ""
    goodOption = False
    while not goodOption:
        option = raw_input("Enter a number or S or Q> ")
        option = option.upper()
        if option == 'S':
            goodOption = True
        elif option == 'Q' :
            goodOption = True
        elif option == "":
            pass
        else:
            isNum = True
            for character in option:
                if character not in "0123456789":
                    isNum = False
            if isNum:
                if int(option) <= 0:
                    isNum = False
                elif int(option) > maxOptions:
                    isNum = False
            if isNum:
                goodOption = True
            else:
                print "Please type a number!"
        if not goodOption:
            print "Invalid Choice, please try again. "
    return option

def menu():
    print "Welcome to Madlibs"
    print "Please Select an Option:"
    print " [1] The honey badger "
    print " [2] Party time"
    print " [S] Settings"
    print " [Q] Quit"
    option = getMenuOption(2)
    return option

def getWord(prompt):
    word = ""
    goodWord = False
    while not goodWord:
        word = raw_input(prompt)
        if word.lower() not in swearList:
            goodWord = True
        else:
            print "Naughty Butt Wacker...Please stop being a butt whipe!"
        if not goodWord:
            print "Please try again."
    return word

def getNumber(prompt, min = "", max = ""):
        num = ""
        goodNumber = False
        while not goodNumber:
            num = raw_input(prompt)
            isNum = True
            for digit in num:
                if digit not in ".0123456789":
                    isNum = False
            if isNum:
                if min != "":
                    if float(num) < min:
                        isNum = False
                if max != "":
                    if float(num) > max:
                        isNum = False
            if isNum:
                goodNumber = True
            else:
                print "Please enter a valid number Dum-b"
        return num
                    
def getColor(prompt):
    colors = ["black",
              "blue",
              "green",
              "bright white",
              "light purple",
              "light aqua",
              "light red",
              "red"]
    opt = ""
    goodColor = False
    while not goodColor:
        opt = raw_input(prompt)
        if opt.lower() in colors:
            goodColor = True
    if opt == "black":
        color = '0'
    elif opt == 'blue':
        color = '1'
    elif opt == 'green':
        color = '2'
    elif opt == 'bright white':
        color = 'F'
    elif opt == 'light red':
        color = 'C'
    elif opt == 'red':
        color = '4'
    elif opt == 'light aqua':
        color = 'b'       
    elif opt == 'light purple':
        color = 'd'
    return color
    
        
            
                    
def story1():
    name1 = getWord("Enter a name: ")
    place = getWord("Enter the name of a place: ")
    adjective1 = getWord ("Enter a adjective: ")
    violentverb1 = getWord ("Enter a violentverb ending in ed: ")
    animal1 = getWord ("Enter a animal: ")
    activity1 = getWord ("Enter activity: ")
    swimming1 = getWord ("Enter a place to swim: ")
    animal2 = getWord ("Enter a animal: ")
    
    
    story = "I have a honey badger named "
    story += name1 + ". "
    story += "The honey badger lives in "
    story += place + ", "
    story += name1 + "  enjoys "
    story += adjective1 + " cobras, and if he gets " + violentverb1 + " he just takes a power nap and gets right back up."
    story += name1 + "s best friend is a " + animal1 + ". "
    story += name1 + " and " + animal1 + " do all sorts of activities together like "
    story += activity1 + ". "
    story += "When " + name1 + " and his friend" + animal1 + " go swimming at the " + swimming1 + ". "
    story += name1 + " favorite floaty is a " + animal2 + " floaty" + ". "
    print story

def story2():
    name = getWord("Enter a name: ")
    age = getNumber("Enter a number: ", 0)
    story = "I have my very own cuddly alien bunny! I named it "
    story += name + ". "
    story += "I think "
    story += name + " is "
    story += age + " years old. "
    print story

def settings():
    txtColor = getColor("Enter Text Color: ")
    bgColor = getColor("Enter Backgound Color: ")
    if txtColor != bgColor:
        os.system("color " + bgColor + txtColor)
    
def run():
    choice = ""
    while choice != 'Q':
        choice = menu()
        if choice == '1':
            story1()
        elif choice == '2':
            story2()
        elif choice == 'S':
            settings()
        elif choice == 'Q':
            print " Goodbye"
            os.system("color " + bgColor + txtColor)
            raw_input("Press enter to exit")
        else:
            print "Something terrible has happened...go yell at the programmer"
    
run()
        
        
        
        
        
        
        